<%@ page language="java" import="java.util.* " pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<!-- <script src="js/zoom.js"></script> -->
 <%@ include file="WEB-INF/jsp/include.jsp"%>
 <script type="text/javascript" src="http://qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js" data-appid="101331959"  charset="utf-8"></script>
	<style>
	body{
		overflow: hidden;
	}
	.news_contain{
		width: 100%;
		height: 100%;
	}
	.news_look {
		width: 100%;
		height: 100%;
		overflow-y: auto;
	}
	.news_look .news_everyone {
		margin-left: 10px;
		font-size: 16px; 
        display: inline-1block;
        vertical-align: middle;
        margin-top: 10px; 
        margin-bottom: 10px; 
        float: none;
        position: relative;
        z-index: 10;
        overflow: hidden;
	}
	.news_transtion{
		 -webkit-transition: all .3s ease-in-out 0s;
	    -moz-transition: all .3s ease-in-out 0s;
	    -ms-transition: all .3s ease-in-out 0s;
	    -o-transition: all .3s ease-in-out 0s;
	    transition: all .3s ease-in-out 0s;
	}
	.news_look_one {
		width: 1000px;
        margin: 6% auto;
        position: relative;
        top:600px;
	}
	.news_left{
	    top: 0px;
	}
	.news_everyone .shade{
		position: absolute;
	    width: 198px;
	    height: 132px;
	    margin-top: -198px;
	    background: Black;
	    -moz-opacity: 0.4;
	    opacity: 0.4;
	    filter: alpha(opacity=70);
	    -webkit-transition: all .3s ease-in-out 0s;
	    -moz-transition: all .3s ease-in-out 0s;
	    -ms-transition: all .3s ease-in-out 0s;
	    -o-transition: all .3s ease-in-out 0s;
	    transition: all .3s ease-in-out 0s;
	    z-index: 10;
    }
    . a
    {
        display: inline-block;
        position: absolute;
        left: 50%;
        top: 50%;
        margin: -16px 0 0 -16px;
        border-radius: 3px;
        background-color: white;
        text-align: center;
        line-height: 32px;
        width: 32px;
        height: 32px;
        text-decoration: none;
        font-size: 18px;
        font-weight: bolder;
        opacity: 0.6;
     }
     .shade a:hover{
        opacity: 1;
     }

	.dropdown {
	  padding-top: 4%;
	  width: 240px;
	  box-shadow: 0 0 40px -10px #000;
	  color: #505050;
	  overflow: hidden;
	  transition: all .5s
	}
	
	.down {
	  max-height: 132px
	}
	
	.history {
	  padding: 2px 11px;
	  margin: 0;
	  transition: all .1s;
	  text-align:center;
	}
	
 	 .history:hover {
	  background: orange;
	  color: white;
	   box-shadow: 0 0 30px -10px #000; 
	  cursor: pointer;
	  z-index:999;
	}  
	.login_buttonT{
	    color: #00ADDE;
	    cursor: pointer;
	    font-size: 14px;
	    font-weight: normal;
	    height: 34px;
	    line-height: 30px;
	    padding:0 15px;
	    text-align: center;
	    text-decoration: none;
	    position: absolute;
	    left: -170px;
	    top: 2px;
	    border: 1px solid #677D8B;
	    border-radius: 4px;
	    width:90px;
	    -webkit-transition: all .2s ease-in-out 0s;
		-moz-transition: all .2s ease-in-out 0s;
		-ms-transition: all .2s ease-in-out 0s;
		-o-transition: all .2s ease-in-out 0s;
		transition: all .2s ease-in-out 0s;
    }
    .login_button:hover{
    	color:white;
    	background-color:#00ADDE ;
    }
    .removenow_news{
        font-style: normal;
	    float: right;
	    position: absolute;
	    right: -4px;
	    top: 0px;
	    z-index: 10;
	    cursor:pointer;
	    width: 1px!important;
	    height: 0!important;
	    border-top: 30px solid black;
	    /* opacity: 0.7; */
	    border-left: 30px solid transparent;
    }
    .removenow_news:before{
    	content: "\2716";
    	color:white;
    	position: absolute;
	    left: -14px;
	    top: -32px;
    	
	}
	.removenow_news:hover{
	    border-top-color: #00DFB9;
	}
	.demoSpan1{
	    margin:0 auto;
		height:70px; 
		width:70px; 
		display:block; 
		position:relative;
	    top:40px;
	    cursor:pointer;
	} 
    .demoSpan1:hover{
	    transform:rotate(90deg);
		-ms-transform:rotate(90deg);
		-moz-transform:rotate(90deg); 
		-webkit-transform:rotate(90deg); 
		-o-transform:rotate(90deg);
    }
	.demoSpan1:before, .demoSpan1:after
	{
		content:'';
		height:5px; 
		width:70px; 
		display:block; 
		background:white; 
		border-radius:10px;
		-webkit-border-radius:10px;
		-moz-border-radius:10px;
		position:absolute; 
		top:32.5px; 
		left:0px;
	}
	.demoSpan1:after{
		height:70px; 
		width:5px; 
		top:0; 
		left:32.5px; 
	}
	.login_register_container{
	    position: absolute;
   	 	z-index: 100;
    	margin: 0 auto;
    	top: -100%;
	}
	#faqbg{
	     background-color:rgba(0,0,0,0.7);
	     position:absolute;
	     z-index:100;
	     left:0;
	     top:0;
	     /* display:none; */
	     width:100%;
	     height:100%;
	     top:-100%; 
	 }
	#login_column{
	   display:none;
	}
	.news_menu{
	    height: 400px;
	    overflow-y: auto;
	}
	.raddnews{
	    font-size: 20px;
    	color: rgba(0,0,0,0.4);
	}
	.addnewsbutton{
	    color: rgba(0,0,0,0.4)!important;
	}
	.addnewsbutton:hover{
	    color: rgba(0,0,0,0.8)!important;
	}
	.addnewsspan{
	    height: 29px;
	    border: 1px dotted #A3A3A3;
	    float: right;
	    position: relative;
	    left: -36px;
	    top: -6px;
	}
	.swiperpagination{
	    width: 70px;
   	    background-color: rgba(0,0,0,0);
	}
	.newssearchicon{
		pointer-events: all!important;
	}
	.newssearchicon:hover{
	   cursor:pointer;
	}
	.sec_nth1 .brief{
	    margin-top:4%;
	}
	.remember_password{
	   /* display: -webkit-inline-box;*/
    	display: inline-block;
    }
    #qqLoginBtn{
        position: relative;
    	top: 4px;
    }

	.ng_binding{
	    cursor:pointer;
	    background: white;
	    padding: 0 6px;
	    border-radius: 4px;
	    color: #555;
	    font-size: 14px;
	    line-height: 21px;
	    min-width: 18px;
	    min-height: 20px;
	    text-align: center;
	    position: absolute;
	    visibility: hidden;
	    left: 10%;
	    z-index:998;
	    margin-top:1%;
	}
	#comment-container{
		display:none;
	    padding-bottom: 5px;
	    position: absolute;
	    left: 459px;
	    top: 496px;
	    z-index: 999;
	    width: 400px;
	    min-height: 180px;
	    max-height: 520px;
	    background-color: #fff;
	    box-shadow: 0 0 0 1px rgba(0,0,0,.1),0 10px 50px 0 rgba(0,0,0,.2);
	    border-radius: 4px;
	    overflow: hidden;
	}
	.comment-head.ng-binding{
		position: absolute;
	    top: 0;
	    right: 0;
	    background-color: #fff;
	    color: #fff;
	    font-weight: 700;
	    height: 24px;
	    width: 24px;
	    box-shadow: 0 0 5px 5px #fff;
	}
	.comment-head.ng-binding .close{
	    height: 24px;
	    width: 24px;
	    margin: 0;
	    padding: 0;
	    overflow: hidden;
	    font-weight: 300;
	    font-size: 24px;
	    line-height: 24px;
	    color: #E1E1E1;
	}
	.comment-head.ng-binding .close:hover{
	    color: #000;
	    text-decoration: none;
	    cursor: pointer;
	}
	.comment-body{
	    width: 100%;
	    max-height: 500px;
	    overflow: scroll;
	    min-height:100px;
	}
	#comment-container .comment-body .comment-list ul {
	    list-style: none;
	    margin: 0;
	    padding: 15px;
	}
	.ucommentuser_name{
		color: rgba(0, 0, 0, 0.870588);
		cursor: pointer;
		display: inline;
		font-family: Lato, 'Helvetica Neue', Arial, Helvetica, sans-serif;
		font-size: 14px;
		font-weight: bold;
		height: auto;
		line-height: 15.2727px;
	}
	.comment_content{
		box-sizing: border-box;
	    color: rgba(0, 0, 0, 0.4);
	    display: inline-block;
	    font-family: Lato, 'Helvetica Neue', Arial, Helvetica, sans-serif;
	    font-size: 12.25px;
	    height: 13.6364px;
	    line-height: 13.3636px;
	    margin-bottom: 0px;
	    margin-left: 0px;
	    margin-right: 0px;
	    margin-left: 3%;
	}
	.iconbtn{
	    pointer-events: all!important;
	    cursor:pointer;
	}
	.hide {
		display: none!important;
	}
	.show{
		display:block!important;
	}
	#embed-captcha{
		width: 67%;
		margin: 0 auto;
	}
	#Login{
		margin-top:2%;
	}
	.QQcontent{
		float: right;
		margin-top: 1%;
	}
</style>
	<body>
		<div class="login_register_container animateClass6">
	<i class="remove remove_icon link big teal icon"></i>
	<div class="animated column" id="login_column">
		<form class="ui large form">
			<div class="ui stacked raised segment">
				<div class="field">
					<div class="ui left icon input">
						<i class="user icon"></i> <input id="login_input_account"
							type="text" placeholder="账号">
					</div>
				</div>
				<div class="field">
					<div class="ui left icon input">
						<i class="lock icon"></i> <input id="login_input_pwd"
							type="password" name="password" placeholder="密码">
					</div>
				</div>
				<div id="embed-captcha"></div>
				<p id="wait" class="show">正在加载验证码......</p>
				<p id="notice" class="hide">请先拖动验证码到相应位置</p>
				<div class="ui fluid login large teal submit button" id="Login">登陆</div>
				<div class="remember_password field">
					<div class="ui checkbox" id="remeberme">
						<input type="checkbox"  value="1" name="rememberpwd" tabindex="0"
							class="hidden"> <label>记住我</label>
					</div>
				</div>
				<div class="QQcontent">
					其他账号登录：
				    <span id="qqLoginBtn"></span>
				</div>
			</div>

		</form>

		<div class="ui register_message  message">
			新用户? <span> 点这儿<i class="add user icon"></i>!
			</span>
		</div>
	</div>

	<div class="animated column" id="regist_column">
	<i class="reply reply_icon link big teal icon"></i>
		<form class="ui large form">
			<div class="ui stacked raised segment">
			<div class="field">
					<div class="ui left icon input">
						<i class="user input_account  icon"></i> <input id="client_name"
							type="text" name="account"
							placeholder="昵称">
					</div>
				</div>
			
				<div class="field">
					<div class="ui left icon input">
						<i class="user input_account  icon"></i> <input id="input_account"
							type="text" name="account"
							placeholder="账号（需包含数字和字母且大于6-20位）">
					</div>
				</div>
				<div class="field">
					<div class="ui left icon input">
						<i class="lock input_pwd  icon"></i> <input id="input_pwd"
							type="password" name="password"
							placeholder="密码（需包含数字和字母且大于6-20位）">
					</div>
				</div>
				<div class="field">
					<div class="ui left icon input">
						<i class="lock input_sure_pwd icon"></i> <input
							id="input_sure_pwd" type="password" name="password"
							placeholder="确认密码 （两次密码需一致）">
					</div>
				</div>
				<div class="field">
					<div class="ui left icon input">
						<i class="call input_phone icon"></i> <input id="input_phone"
							type="text" name="input_phone" placeholder="手机">
					</div>
				</div>
				<div class="field">
					<div class="ui left icon input">
						<i class="mail input_email icon"></i> <input id="input_email"
							type="text" name="input_email" placeholder="E-mail">
					</div>
				</div>
				<div class="field">
					<div class="ui left icon input">
						<i class="qq input_qq icon"></i> <input id="input_qq" type="text"
							name="input_qq" placeholder="QQ">
					</div>
				</div>
				<div class="ui fluid  large teal submit button" id="login_out">注册</div>
			</div>

		</form>

	</div>
</div>
<div id="faqbg" class="animateClass6"> <i class="remove remove_addnewicon link big teal icon"></i>
    <div class="ui fluid vertical menu news_menu animateClass" style="width: 40%!important;margin: 7% auto;">
        <div class="ui category search">
		  <div class="ui icon input" style="margin-left: 0%;width: 25%;height: 46px;">
		    <input class="prompt" type="text"  placeholder="输入搜索报纸名称">
		    <i class="search icon iconbtn"></i>
		  </div>
		</div> 
     </div>
</div>
		<header>
        <div class="logo">
          <img src="./static/Images/logo.png"class="img-responsive" />
        </div>
        <strong class="words">您身边的报刊亭</strong>
        <nav class="menu">
          <ul class="list-inline mouse_list">
          </ul>
          <i class="line" ></i>
        </nav>
        <div class="hotline">
        <div class="login_buttonT">登陆</div>
          <a href="tel:18752002039"><span>18752002039</span></a><u></u>
        </div>
        <div class="bg"></div>
    </header>
	 <div class="swiper-container" id="nth_swiper">
        <div class="swiper-wrapper">
	<section class="swiper-slide sec_nth sec_nth1">
    	<div class="swiper-containerT">
            <div class="swiper-wrapper">
              <div class="swiper-slide swiper-nth nth1">
                <div class="box hidden">
                	<div class="news_info_line">
                		<div class="word-contain word_01 hidden animated">
                			<p>最全</p>
                			<p>系统提供<span class="yellow_word">28</span>种报刊阅览</p>
                			<p>同时支持自动搜索拓展</p>
                			<p>支持<span class="yellow_word">5</span>天以内的报纸浏览</p>
                			<p>想你所想，看你所看</p>
                		</div>
                		<div class="img hidden"></div>
                	</div>
                  <div class="left animated">
                  	<div class="word-contain word_03 hidden">
                  		<p>最新</p>
                		<p>后台系统自动为您采集最新报刊</p>
                		<p>保证报刊的新鲜度</p>
                		<p>让您不错过任何新闻实事</p>
                  	</div>
                  	<div class="img hidden"></div></div>
                 <div class="right ">
                 	<div class="word-contain word_02 hidden">
                  		<p>最方便</p>
                		<p>一站式阅览，无需复杂的搜索流程</p>
                		<p>截止今天，共搜集<span class="yellow_word" id="news_amount"></span>份报纸</p>
                		<p>一键浏览，方便快捷</p>
                  	</div>
                  	<div class="img hidden"></div>
                	<span class="animated">lienlab news</span>
                	<br/>
                	<p class="alienChi animated">看天下</p>
                    <p class="brief animated">个性化定制<br/>只属于你的报刊阅览平台</p>
                  </div>
                </div>
              </div>
            </div>
        </div>
    </section>
    
    <section class="swiper-slide sec_nth sec_nth2">
      <div class="news_contain">
      	  <div class="news_look">
      	   <div class="search-wrapper">
                <div class="input-holder">
                    <input type="text" class="search-input" placeholder="请输入搜索网址..." />
                    <button class="search-icon" onclick="searchToggle(this, event);"><span></span></button>
                </div>
                <span class="close" onclick="searchToggle(this, event);"></span>
                <div class="result-container">

                </div>
            </div>
		<div class="news_look_one news_transtion">
			<div class=" news_everyone add_news " >
				<div class="new_img new_img16 ">
					<span class="demoSpan1 animateClass"></span>
				</div>
			</div>
		</div>
	</div>
      </div>
    </section>
    
    <section class="swiper-slide sec_nth sec_nth3">
	    <div class="box animateClass">
	    	<div class="above animateClass">
	    	     <img src="./static/img/question1.png" class="question1 question animateClass">
	    	    <img src="./static/img/question2.png" class="question2 question animateClass">
	    	    <img src="./static/img/question3.png" class="question3 question animateClass">
	    	    <img src="./static/img/question4.png" class="question4 question animateClass">
	    	</div>
	    	<div class="below animateClass">
	    	     <img src="./static/img/wechat_code.png" class=" animateClass">
	    	     <div class="left">
	    	     	<p>开发团队：alienlab工作室</br>联系电话：15251700039<br>地址：南京市栖霞区羊山北路1号 <br>邮编：210046</p>
	    	     </div>
	    	     <div class="right">
	    	        <p>Emial：zgyxx091418@163.com <br>邮编：210046<br></p>
	    	     </div>
	    	</div>
	    </div>
    </section>
    </div>
    </div>
    <div id="comment-container"  >
			  <div class="comment-head ng-binding">
			    
			    <span class="close" >×</span>
			  </div>
			  <div class="comment-body">
			    <div class="comment-list no-login" >
			      <ul id="comment_conent">
			        <li  class="">暂无评论</li>
			      </ul>
			    </div>
			  </div>
			  <div class="comment-compose ng-hide" ng-show="currentCommentUser.username">
			    <div class="form-group"> <textarea class="ui input contentarea" style="resize: none;width: 96%; padding: 6px 10px;background-color: #fff;border: 1px solid #d0d0d0;      border-radius: 4px;margin-left: 2%;"></textarea></div>
			    <div class="form-meta">
			      <button class="ui primary button commentbtn" style="margin-left: 80%;">评论</button>
			    </div>
			  </div>
			</div>
	</body>
	
<script>
    window._bd_share_config={
    		"common":{"bdSnsKey":{},
    			      "bdText":"非常不错的报刊阅读网站，一起来瞧瞧吧！",
    			      "bdMini":"1",
    			      "bdMiniList":["tsina","sqq","weixin","renren","qzone","youdao","fx","copy"],
    			      /* "bdPic":"", */
    			      "bdUrl": "http://bzyd.niit.edu.cn/alienlabnews",
    			      "bdStyle":"2",
    			      "bdSize":"24"},
    			      "slide":{"type":"slide","bdImg":"2","bdPos":"right","bdTop":"250"}
   };
    with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
</script>
<script type="text/javascript"
src="http://qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js" charset="utf-8" data-callback="true"></script>
<script type="text/javascript">
    QC.Login({
       btnId:"qqLoginBtn",    //插入按钮的节点id
       size: "C_S"
}, function(reqData, opts){//登录成功
	QC.Login.getMe(function(openId, accessToken){
		var currentUser = AV.User.current();
		if(currentUser){
			return;
		}
		var news_data = [];
		news_data.push(1);
		news_data.push(2);
		news_data.push(4);
		news_data.push(5);
		news_data.push(6);
		news_data.push(7);
		news_data.push(9);
		news_data.push(10);
		news_data.push(11);
		news_data.push(12);
		news_data.push(13);
		news_data.push(14);
		news_data.push(17);
		news_data.push(18);
		news_data.push(19);
		var user = new AV.User();
		// 设置用户名
		  user.setUsername(openId);
		  // 设置密码
		  user.setPassword('123456');
		user.set('user_news_config',news_data);
		user.set('client_name',reqData.nickname);
		
		user.signUp().then(function(user) {
			login(openId,"123456");
		}, function(error) {
			 login(openId,"123456"); 
		});
		//注销
		/* QC.Login.signOut() */
		
	})
	
    //根据返回数据，更换按钮显示状态方法
  //QC.Login.signOut():注销登录
}, function(opts){//注销成功
	//注销之后的方法
});
    function login(input_account, input_pwd){
    	console.log(input_account+input_pwd)
	    AV.User.logIn(input_account, input_pwd).then(function() {
			//得到这个用户
			var currentUser = AV.User.current();
			if (currentUser) {
				//登陆之后得到这个用户
			 console.log(currentUser);
			 location.href="./new_file.jsp";
			} else {
		     alert('账号或密码错误')
			}
		}, function() {
			//验证失败之后做什么事情
			alert("登陆失败");
		});
    }
</script>
<script>
function searchToggle(obj, evt){
	var BASE_PATH='<%=BASE_PATH%>' ;
    var container = $(obj).closest('.search-wrapper');

    if(!container.hasClass('active')){
    	$('.news_look_one').css('top','40px');
    	setTimeout(function(){
    		container.addClass('active');
            evt.preventDefault();
    	},400)
          
    }
    else if(container.hasClass('active')  ){
    	if($(obj).closest('.input-holder').length == 0){
          container.removeClass('active');
          // clear input
          container.find('.search-input').val('');
          // clear and hide result container when we press close
          container.find('.result-container').fadeOut(100, function(){$(this).empty();});
          setTimeout(function(){
        	  $('.news_look_one').css('top','0px');
          },300)
    	}else{
    		var url=$('.search-input').val();
    		if(url=="" || url==null){
    			alert('搜索网址不为空！')
    		}else{
    			$.ajax({
    				url: "../news/getUrl",
    				type: 'POST',
    				dataType: 'json',
    				data: {
    					newarrurl:url
    				},
    				success: function(rep) {
    					console.log(rep)
    					alert('正在搜索，请稍等。。。')
    					if(rep.length==0){
    						alert('网址错误或者网站PDF为空，无法查看！')
    					}else{
    						setTimeout(function(){
    							open(BASE_PATH+"generic/web/iframe.jsp?pdf_urls="+encodeURIComponent(rep)+"");
    						},3000)
    					}
    				}
    			});
    		}
    	}
    }
}
	$(function(){
		$('.comment-head.ng-binding .close').unbind('click').click(function(){
			$('#comment-container').fadeOut();
		})
		var menu_list=['首页','阅览','联系']
		 var new_arr_person=[1,2,4,5,6,7,9,10,11,12,13,14,17,18,19];
		var currentUser = AV.User.current();
		var loginflag=false;
		if(currentUser){
			loginflag=true;
			$('.login_buttonT').html('退出登录');
			$('.login_buttonT').addClass('logOut');
			logOut();
			new_arr_person=currentUser._serverData.user_news_config
			console.log(new_arr_person)
		}else{
			login();
		}
	
	var BASE_PATH='<%=BASE_PATH%>';
	//可添加报纸
	var ableaddnews={
			news_no:[],
			news_name:[]
	}
	//swiper当前是第几页
		var pagecontent=0;
		//动画库
		var animateIn=[];
	    	animateIn.push('bounceIn')
	    	animateIn.push('bounceInRight')
	    	animateIn.push('bounceIn')
	    	animateIn.push('bounceInRight')
	    	animateIn.push('bounceInUp')
	    	animateIn.push('bounceInLeft')
	    	animateIn.push('bounceInDown')
	    	animateIn.push('bounceInRight')
	    	animateIn.push('bounceIn')
	    	animateIn.push('bounceIn')
	    	animateIn.push('bounceInDown')
	    	animateIn.push('bounceInLeft')
	    	animateIn.push('bounceIn')
	    	animateIn.push('bounceInLeft')
	 var todata = date2str(new Date(), "yyyy-MM/dd")
	 function login(){
		 $('.login_buttonT').unbind('click').click(function(){
			 $('.login_register_container').css('top','0%');
			 $('#login_column').show();
		 })
	 }
	 webstar();
	 function webstar(){
		 setmiddlength4();
		 flushnews();
		 addnews();
		//画报纸
	     paintnews();
	     setnthHeight();
	     setTimeout(function(){
	    	 $('.loadingsegment').remove();
	    	 animatebox();
	     },1000);
	 }
	 //开始写页面逻辑
	 function setmiddlength4(){
		 $('.searchinput').unbind('click').click(function(){
			 $(this).css({"width":"90%", "margin-left":"10%","height":"48px"});
		 })
		/*  $('.prompt').unbind('blur').blur(function(){
			 $(this).parent().css({"width":"50%", "margin-left":"30%","height":"37px"});
		 }) */
		 var height = $('.sec_nth4 .box').height();
		 height = parseInt((window.innerHeight-height)/2);
		 console.log(height);
		 $('.sec_nth4 .box').css('top',height);	 
	 }
	 $('.news_menu').hide();
	 function logOut(){
		 $('.logOut').unbind('click').click(function(){
			 $('.logOut').unbind('click')
			 AV.User.logOut();
			 if(QC.Login.check()){
				 QC.Login.signOut()
			 }
			 location.href="./new_file.jsp";
		 })
	 }
	
	 function addnews(){
		 $('.demoSpan1').unbind('click').click(function(){
			 if(!loginflag){
				 alert('登陆后才可进行个人设置！');
				 return;
			 }
			 $('.news_menu').show();
			 $('#faqbg').css('top','0%');
		 })
		 $('.remove_addnewicon').unbind('click').click(function(){
			 $('#faqbg').css('top','-100%');
			 setTimeout(function(){
				 $('.news_menu').hide();
			 },600)
		 })
	 }

		$('.remove.remove_icon').unbind('click').click(function(){
			$('.login_register_container').css('top','-100%');
		})
	 function flushnews(){
		 var dayNews = new AV.Query('news_pdf');
		 dayNews.count().then(function(objectnews) {
			 console.log(objectnews)
			 console.log(objectnews.length)
			 $('#news_amount').html(objectnews)
		 }, function(error) {
			 $.alert('报纸数量查询出错，请联系管理员')
		 }); 
	 }
	var swiper = new Swiper('.swiper-container', {
		effect : 'flip',
        mousewheelControl : true,
        direction: 'vertical',
        speed:300,
        keyboardControl : false,
        initialSlide :0,
        lazyLoading : true,
        pagination: '.mouse_list',
        paginationClickable: true,
        paginationBulletRender: function (index, className) {
        	if(index==0){
        		return '<li class="'+className+' swiperpagination active" ><a>'+menu_list[index]+'</a></li>';
        	}
            return '<li class="'+className+' swiperpagination" ><a>'+menu_list[index]+'</a></li>';
        },
        height : window.innerHeight,
        onSlideChangeStart: function(swiper){
        	pagecontent=swiper.activeIndex;
        	if(swiper.activeIndex==1 && (!$('.news_transtion:first').hasClass('news_left'))){
        		shownews();
        	}
        	if(swiper.activeIndex==0){
        		$('header').removeClass('fixed');
        		$('nav .line').removeClass('fixedline');
        			
        	}else{
        		if(!$('header').hasClass('fixed')){
        			$('header').addClass('fixed');
        		}
        		if(!$('nav .line').hasClass('fixedline')){
        			$('nav .line').addClass('fixedline');
        		}
        	}
        	setTimeout(changeleft,200)
    	},
    	onInit: function(swiper){
    		 setLineSet(); 
    		 limove();
    	 }
    });
    
    function removeNews(){
    	$('.removenow_news').unbind('click').click(function(){
    		$('.removenow_news').unbind('click')
    		if(!loginflag){
    			alert('登录才能进行个人设置！')
    			return;
    		}
    		var _this = $(this)
    		var news_name =  $(_this).attr('news_name')
    		var news_no = $(_this).parent().parent().attr('new_no')
    		console.log(news_name)
    		console.log(news_no)
    		paintRaddnews(news_no,news_name)
    		$(_this).parent().parent().addClass('animated zoomOutDown')
    		var news_no = $(_this).parent().parent().attr('new_no');
    		 var length=0;
    		for (var i = 0; i < new_arr_person.length; i++) {
				if(new_arr_person[i]==parseInt(news_no)){
					new_arr_person.splice(parseInt(length),1) 
					//再写入数据库
					currentUser.set('user_news_config',new_arr_person);
					currentUser.save().then(function(){
					})
					break;
				}
				length++;
			}
    		setTimeout(function(){
    			$(_this).parent().parent().remove();
    		},700)
    		
    	})
    	setTimeout(removeNews,700);
    }
    
    function changeleft(){
    	setLineSet()
    }
    function limove(){
	    $('.mouse_list li').unbind('mouseenter').mouseenter(function(){
	    	setLineSet($(this))
	    })
	    $('.menu .mouse_list').unbind('mouseleave').mouseleave(function(){
	    	setLineSet()
	    })
    }
    
    function setLineSet(_this){
    	var X="";
    	if(_this==null || this==""){
    		X = $('.mouse_list li.swiper-pagination-bullet-active').offset().left
    	}else{
    		X = $(_this).offset().left
    	}
    	if($('nav .line').width()==54){
    		$('nav .line').css('left',X+7);
    	}else{
    		$('nav .line').css('left',X+11);
    	}
    }
    function changeheight(){
    	swiper.destroy(true,true)
    	swiper = new Swiper('.swiper-container', {
		effect : 'flip',
        mousewheelControl : true,
        direction: 'vertical',
        speed:300,
        keyboardControl : false,
        lazyLoading : true,
        pagination: '.mouse_list',
        paginationClickable: true,
        paginationBulletRender: function (index, className) {
        	if(index==0){
        		return '<li class="'+className+' swiperpagination active" ><a>'+menu_list[index]+'</a></li>';
        	}
            return '<li class="'+className+' swiperpagination" ><a>'+menu_list[index]+'</a></li>';
        },
        initialSlide :pagecontent,
        height : window.innerHeight,
        onSlideChangeStart: function(swiper){
        	$('.mouse_list li').removeClass('active');
        	$('.mouse_list li[index='+swiper.activeIndex+']').addClass('active')
        	pagecontent=swiper.activeIndex;
        	if(swiper.activeIndex==1 && (!$('.news_transtion:first').hasClass('news_left'))){
        		shownews();
        	}
        	if(swiper.activeIndex==0){
			$('header').removeClass('fixed');
			$('nav .line').removeClass('fixedline');

		}else{
			if(!$('header').hasClass('fixed')){
				$('header').addClass('fixed');
			}
			if(!$('nav .line').hasClass('fixedline')){
				$('nav .line').addClass('fixedline');
			}
		}
			setTimeout(changeleft,200)
		},
			onInit: function(swiper){
    		setLineSet();
    		limove();
    	 }
    });
    }
    
    function setnthHeight(){
    	$('.swiper-containerT .swiper-nth').height(window.innerHeight)
    	$('.swiper-containerT .swiper-nth .box').css('margin-top',(window.innerHeight*0.4))
         
    }
    //监听屏幕尺寸变化时
    $(window).unbind('resize').resize(function() {
    	setmiddlength4();
    	setLineSet()
    	setnthHeight();
    	setTimeout(changeheight,50)
    })
    function shownews(){
    	   setTimeout(function(){   
    		$('.news_transtion').addClass('news_left');
    	   },50)  
    }
    function animatebox(){
    	$('.nth1 .box').removeClass('hidden')
    	$('.nth1 .box .left').addClass('bounceInLeft')
    	$('.nth1 .box .right span').addClass('bounceInDown')
    	$('.nth1 .box .right .alienChi').addClass('bounceInRight')
    	$('.nth1 .box .right .brief').addClass('bounceInUp')
    	setTimeout(firstImgshow,1500)
    	
    }
    function firstImgshow(){
    	$('.news_info_line .img').removeClass('hidden')
    	$('.word_01').addClass('zoomIn')
    	$('.word_01').removeClass('hidden')
    	setTimeout(secondImgshow,1700)
    }
    function secondImgshow(){
    	$('.word_01').removeClass('zoomIn')
    	$('.right .img').removeClass('hidden')
    	$('.word_02').addClass('zoomIn')
    	setTimeout(secondImgshow2,700)
    }
    function secondImgshow2(){
    	$('.word_02').removeClass('hidden')
    	setTimeout(thirdImgshow,700)
    }
    function thirdImgshow(){
    	$('.word_02').removeClass('zoomIn')
    	$('.left .img').removeClass('hidden')
    	$('.word_03').addClass('zoomIn')
    	setTimeout(thirdImgshow2,700)
	}
function thirdImgshow2(){
	$('.word_03').removeClass('hidden')
	setTimeout(thirdImgshow3,700)
}
    function thirdImgshow3(){
    	$('.word_03').removeClass('zoomIn')
    }
    function insertnewsPdf(rep,i){
    	var sql='select * from news_pdf where news_no='+parseInt(rep[i][0].news_name)+' and news_time="'+rep[i][0].news_time+'"';
    	AV.Query.doCloudQuery(sql).then(function(results) {
    			if((results.results.length==0) && (rep[i][1].length>0)){
    				var url=[];
    				for (var t = 0; t < rep[i][1].length; t++) {
    					url.push(rep[i][1][t])
					}
    				var daynewSave =  AV.Object.extend('news_pdf');
    				var daynewsave = new daynewSave();
    				daynewsave.save({
    					news_no:parseInt(rep[i][0].news_name),
    					news_pdf_url:url,
    					news_time:rep[i][0].news_time 
    				}).then(function(post) {
    					  console.log("保存成功")
    					}, function(err) {
    					  console.log("保存失败")
    					});
    			}
    			  
    			}, function(error) {
    			   alert('报纸查询错误')
    			}); 
    }
    //日期格式化函数
     function date2str(x, y) {
		   var z = {
		      y: x.getFullYear(),
		      M: x.getMonth() + 1,
		      d: x.getDate(),
		      h: x.getHours(),
		      m: x.getMinutes(),
		      s: x.getSeconds()
		   };
		   return y.replace(/(y+|M+|d+|h+|m+|s+)/g, function(v) {
		      return ((v.length > 1 ? "0" : "") + eval('z.' + v.slice(-1))).slice(-(v.length > 2 ? v.length : 2))
		   });
		}
     function startflush(allnews){
    	 var path='<%=path%>';
         var newarrno=[];
         var newarrurl=[];
	   	 for (var i = 0; i < allnews.length; i++) {
	   		 newarrno.push(allnews[i]._serverData.news_no)
	   		 newarrurl.push(allnews[i]._serverData.news_url)
	   	 } 
   	    $.ajax({
   			url : "do?invoke=flushnews@getUrl",
   			type : 'POST',
   			dataType : 'json',
   			data:{
   				newarrno:newarrno.join('##'),
   				newarrurl: newarrurl.join('##'),
   				path:path,
   			},
   			success : function(rep){ 
   				for (var i = 0; i < rep.length; i++) {
   					insertnewsPdf(rep,i);
   				}
   			}
   		});  
     }
     function paintnews(){
    	 var allNews = new AV.Query('tb_news');
    	 allNews.addAscending('news_no');
	     allNews.find().then(function(allnews) {
	    	 for (var i = 0; i < allnews.length; i++) {
				if($.inArray(allnews[i]._serverData.news_no,new_arr_person)!=-1){
					paintCardnews(new_arr_person[$.inArray(allnews[i]._serverData.news_no,new_arr_person)],allnews[i]._serverData.news_name);
				}else{
					if(loginflag){
						ableaddnews.news_no.push(allnews[i]._serverData.news_no)
						ableaddnews.news_name.push(allnews[i]._serverData.news_name)
					}
				}
			}
	    	 
	    	 if(loginflag){
	    	 	paintRaddnews();
	    	 }
	    	 removeNews(); 
	     }, function(error) {
		 	$.alert('报纸信息查询出错，请联系管理员')
		 });
     }
     
     //画可以添加的报纸的DON
     function paintRaddnews(news_no,news_name){
    	 console.log(news_no)
    	 if(typeof(news_no)=="undefined" ){
	    	 for (var i = 0; i < ableaddnews.news_name.length; i++) {
				var dom='<a class="raddnews item"  new_no="'+ableaddnews.news_no[i]+'" data-content="点击按钮添加此报纸">'+
		          '<span class="addnewsname">'+ableaddnews.news_name[i]+'</span>'+
		          '<span class="addnewsspan"></span>'+
		          '<i class="plus icon addnewsbutton animateClass"></i>'+
		          '</a>';
		          $('.news_menu').append($(dom))
			}
    	}else{
    		var dom='<a class="raddnews item"  new_no="'+news_no+'" data-content="点击按钮添加此报纸">'+
	          '<span class="addnewsname">'+news_name+'</span>'+
	          '<span class="addnewsspan"></span>'+
	          '<i class="plus icon addnewsbutton animateClass"></i>'+
	          '</a>';
	          $('.news_menu').append($(dom))
    	}
    	 $('.raddnews').popup();
    	 bindaddnewsclick();
    	 $('.iconbtn').unbind('click').click(function(){
    		 if($('.prompt').val()==""){
    			 $('.raddnews').show();
    			 return;
    		 }
    		 var addnewsname = $('.addnewsname')
    		 for(var  i = 0 ;i<addnewsname.length;i++){
    			 if($(addnewsname[i]).text().indexOf($('.prompt').val())==-1){
    				 $(addnewsname[i]).parent().hide();
    			 }else{
    				 $(addnewsname[i]).parent().show();
    			 }
    		 }
    	 })
     }
     
     //添加按钮点击事件
     function bindaddnewsclick(){
    	 $('.addnewsbutton').unbind('click').click(function(){
    		 var news = $('.news_everyone')
    		 if(news.length==16){
    			 alert('抱歉！最多添加15份报纸。')
    			 return;
    		 }
    		 $('.raddnews').popup('hide');
    		 $(this).parent().fadeOut();
    		 $(this).parent().remove();
    		 var news_no =   $(this).parent().attr('new_no');
    		 var news_name = $(this).parent().find('.addnewsname').html();
    		 new_arr_person.push(parseInt(news_no))
    		 console.log(new_arr_person)
			 currentUser.set('user_news_config',new_arr_person);
			 currentUser.save().then(function(){
			 })
			 paintCardnews(news_no,news_name)
    	 })
     }
     function paintCardnews(i,news_name){
    	 var dom='<div class="  news_everyone news_everyone'+i+'  animated " new_no="'+i+'">'+
			'<div class="shade"><i class="animateClass close icon removenow_news" news_name="'+news_name+'"></i><div class="menu">'+
			  ' <div class="dropdown dropdown'+i+'">'+
			  ' </div>'+
			' </div></a></div>'+
		' <div class="new_img new_img'+i+'"></div>'+
	    '</div>';
		$('.add_news').before($(dom))
		var query = new AV.Query('news_pdf');
		query.equalTo('news_no', parseInt(i));
		// 最新的在前面
		query.addDescending('createdAt');
		query.limit(5);
		query.find().then(function(result) {
			var item ='';
			  for (var t = 0; t < result.length; t++) {
			    item+='<span class="animateClass ng_binding">+</span><p class="history" pdf_url="'+result[t]._serverData.news_pdf_url+'">'+result[t]._serverData.news_time+'期 </p>';
			  }
			  $('.dropdown'+i+'').append($(item))
			  hoverfunciton();
			  dropdownclick();
			}, function(error) {
			  console.log(error);
			});
     }
     function hoverfunciton(){
    	 $('.ng_binding').css('visibility','hidden'); 
		  $('.history').unbind('hover').hover(function(){
			 $(this).prev().css('visibility','visible');
		 }) 
		  $('.ng_binding').mouseleave(function(){
			 /* $(this).prev().css('visibility','hidden'); */
			 $(this).css('visibility','hidden');
		 }) 
		  $('.shade').mouseleave(function(){
			 /* $(this).prev().css('visibility','hidden'); */
			 $(this).children('.menu').children('.dropdown.dropdown7').children('span').css('visibility','hidden');
		 })
		 /*  $('.ng_binding').hover(function(){
			 unbindclick();
		 }) 
		  $('.ng_binding').mouseleave(function(){
			  dropdownclick();
		 })  */
		  $('.ng_binding').unbind('click').click(function(e){
				 if(!loginflag){
		    			alert('登录才能进行报刊评论！')
		    			return;
		    		}
					 var pointX = e.pageX;
					 var pointY = e.pageY;
					 var newstime = $(this).next().text();
					 var new_no = $(this).parent().parent().parent().parent().attr("new_no")
					 newstime=newstime.substring(0,newstime.length-2)
					 console.log(newstime)
					 console.log(new_no)
					    var cql = 'select * from news_comment where comment_newno = '+ parseInt(new_no)+' and comment_newtime="'+newstime.toString()+'"';
					 console.log(cql) 
					 AV.Query.doCloudQuery(cql).then(function (data) {
					      var results = data.results;
					     /* if(results.length!=0){
					    	  $('#comment_conent').html("");
					      }*/
						 $('#comment_conent').html("");
						 $('.contentarea').html("");
					      for(var i = 0;i<results.length;i++){
					    	  var oDate1 = new Date(results[i].createdAt).Format("yyyy-MM-dd hh:mm:ss");
					    	  console.log(oDate1)
					    	  var dom = '<li>'+
					    	  '<p style="margin-bottom: 0px;"><span class="ucommentuser_name">'+results[i]._serverData.comment_user+'</span><span class="comment_content">'+oDate1 +'</span></p>'+
					    	  '<p>'+results[i]._serverData.comment_content+'</p>'+
					    	  '<div class="ui divider" style="margin-top: 5px;margin-bottom: 5px;"></div>'+
					    	  '</li>';
					    	  $('#comment_conent').append($(dom))
					      }
					      $('#comment-container').css({"left":pointX,"top":pointY})
						  $('#comment-container').fadeIn();
						  comment(newstime,new_no);
					  }, function (error) {
						  alert("消息获取出错！")
					  }); 
			 })
     }
     
     Date.prototype.Format = function (fmt) { //author: meizz 
    	    var o = {
    	        "M+": this.getMonth() + 1, //月份 
    	        "d+": this.getDate(), //日 
    	        "h+": this.getHours(), //小时 
    	        "m+": this.getMinutes(), //分 
    	        "s+": this.getSeconds(), //秒 
    	        "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
    	        "S": this.getMilliseconds() //毫秒 
    	    };
    	    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    	    for (var k in o)
    	    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    	    return fmt;
    	}
     function comment(newstime,new_no){
    	 $('.commentbtn').unbind('click').click(function(){
    		 if($('.contentarea').val()==""){
    			 alert("请输入评论内容！")
    		 }else{
    			 var content = $('.contentarea').val();
    			 var currentUserT = AV.User.current()._serverData.client_name;
    			 console.log(currentUserT)
    			  // 声明类型
    			  var TodoFolder = AV.Object.extend('news_comment');
    			  // 新建对象
    			  var todoFolder = new TodoFolder();
    			  // 设置名称
    			  todoFolder.set('comment_newtime',newstime.toString());
    			  todoFolder.set('comment_content',content.toString());
    			  todoFolder.set('comment_newno',parseInt(new_no));
    			  todoFolder.set('comment_user',currentUserT.toString());
    			  // 设置优先级
    			  todoFolder.set('priority',1);
    			  todoFolder.save().then(function (todo) {
    				  $('.contentarea').val('');
    				  $('#comment-container').fadeOut();
    			  }, function (error) {
    			    console.log(error);
    			  });
    		 }
    	 })
     }
     
     function unbindclick(){
    	 $('.history').unbind('click');
     } 
	 function dropdownclick(){
		 $('.history').unbind('click').click(function(){
			 $('.history').unbind('click');
			 var url=$(this).attr('pdf_url');
			 open(BASE_PATH+"generic/web/iframe.jsp?pdf_urls="+encodeURIComponent(url)+"");
		 })
		 setTimeout(dropdownclick,500);
	 }
		//初始化验证是否保存了密码

		$('#Login').unbind('click').click(function() {
			var input_account = $('#login_input_account').val();
			var input_pwd = $("#login_input_pwd").val();
			if(input_account=="" || input_pwd==""){
				alert("用户名或密码为空！");
				return ;
			}
			if(typeof (validateT.getValidate().geetest_challenge)=="undefined"){
					alert("请先通过验证！");
					return ;
				}
			AV.User.logIn(input_account, input_pwd).then(function() {
				//得到这个用户
				var currentUser = AV.User.current();
				if (currentUser) {
					//登陆之后得到这个用户
					console.log(currentUser);
					location.href="new_file.jsp";
				} else {
					alert('账号或密码错误')
				}
			}, function() {
				//验证失败之后做什么事情
				alert("登陆失败");
			});
		});
})
</script>
<script src="<%=BASE_PATH%>/static/js/loginJs.js"></script>
</html>
